package tronglv.gs.animation;

import org.andengine.opengl.texture.region.ITiledTextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;

import tronglv.gs.model.AnimateMySprite;

public class anijewelpurple extends AnimateMySprite {
	private int x, y;
	private long T1, T2;
	private int count;

	public anijewelpurple(float pX, float pY, float pWidth, float pHeight,
			ITiledTextureRegion pTiledTextureRegion,
			VertexBufferObjectManager pVertexBufferObjectManager, int x, int y) {
		super(pX, pY, pWidth, pHeight, pTiledTextureRegion,
				pVertexBufferObjectManager);
		this.x = x;
		this.y = y;
		count = x;
		T1 = T2 = System.currentTimeMillis();
	}

	@Override
	public void action() {
		T2 = System.currentTimeMillis();
		if (T2 - T1 > 100) {
			T1 = T2;
			this.setCurrentTileIndex(count);
			if (count < y) {
				count += 1;
			} else {
				count = x;
			}
		}
	}

}
